import axios from 'axios'
import { Toast } from 'vant'
const ajax = axios.create()
// 拦截器
let toast = ''
ajax.interceptors.request.use(config => {
  toast = Toast.loading({
    duration: 0, // 持续展示 toast
    forbidClick: true, // 禁用背景点击
    loadingType: 'spinner',
    message: '加载中...'
  })
  return config
})

ajax.interceptors.response.use(resp => {
  toast.clear()
  return resp.data
})

export const getListName = () => {
  return ajax.get('Check/getAllInfo')
}
export const getTosubmit = a => {
  return ajax.post('check/index_phone/14', a)
}
export const getjcList = () => {
  return ajax.get('check/getinfo')
}
export const getPrice = id => {
  return ajax.get(`Order/index_phone?id=${id}`)
}
export const getTopay = data => {
  return ajax.post('m/mobile/pay_phone', data)
}
export const getLogin = data => {
  return ajax.post('user/login', data)
}
export const getChecklist = () => {
  return ajax.post('Order/list')
}
